import React from 'react'
import {GetServerSideProps, } from 'next'
import { useRouter } from 'next/router'
// import Testjoyride from '@components/joyride'

import LearnSass from '@components/LearnSass/LearnSass'

interface Props {
  data: any
}

export default function guide(props: Props) {
  const {data} = props
  return (
    <div>
      guide
      {/* <div className='my-first-step'>first</div>
      <div className="my-other-step">other</div> */}
      {/* <Testjoyride />   */}
      
      <LearnSass />


      {
        data?.data && data.data.map((item: any, index: number) => (
          <div key={item.id+item.NOEDATE + index}>{item.NOEDATE} - {item.Zqmc} - {item.Zxsz} - {item.Dryk} </div>
        ))
      }

    </div>
  )
}

export const getServerSideProps: GetServerSideProps = async (context) => {
  const params = context.params
  let allData = []
  debugger
  try {
    allData = await fetch('http://localhost:3535/wealth').then(data => data.json())
    // for (const item of datas) {
    //   allData.push({
    //     id: item.id,
    //     NOEDATE: item.NOEDATE,
    //     Zqmc: item.Zqmc,
    //     Zxsz: item.Zxsz,
    //     Dryk: item.Dryk
    //   })
    // }
  } catch (error) {
    
  }
  return {
    props: {
      data: allData
    }
  }
}
